﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <title>动态</title>
    <link rel="stylesheet" type="text/css" href="../plugins/weui/css/weui.min.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css">
    <link rel="stylesheet" type="text/css" href="../css/css.css">
    <link rel="stylesheet" href="../css/app.css">
    <link rel="stylesheet" href="../css/blog.css">
    <style>
        html {background-color:#fff;}
    </style>
</head>
<body>
    <div class="container1">
        <div id="list" style="width: 95%;margin-left: auto;margin-right: auto;">
            <!--微博内容-->
            <ul class="blog-content">
            </ul>
        </div>
    </div>
</body>
<script type="text/javascript" src="../js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="../plugins/weui/js/weui.min.js"></script>
<script type="text/javascript" src="../js/base.js"></script>
<script src="../js/blog.js"></script>
<script type="text/javascript">

    $(function () {
        loadBlog();
    })

    function loadBlog() {
        var blogid = getQueryString("blogid")
        ajaxGet(siteApiList.MyBlogDetail + "?blogid=" + blogid, function (data) {
            if (!isJsonSuccess(data))
                return;
            if (data.Data == null) return;
            var item = data.Data;
            html = getItemHtml(item.BlogInfo, item.BlogInfo.Imgs, item.UpList, item.CommentList,item.NickName, item.Avater);
            $(".blog-content").html(html)
            loadBtn();
        })
    }

    function getItemHtml(item, Imgs, UpList, CommentList,NickName,Avater) {
        var upList = getUpList(UpList);
        var commentList = getCommentList(CommentList); //评论列表
        var html = "";
        html += "<li>"
        html += "<div class='po-avt-wrap'><img class='po-avt data-avt' src='" + siteConfig.formatAvater(Avater) + "'></div>"
        html += "<div class='po-cmt'>"
        html += "<div class='po-hd'>"
        html += "<p class='po-name' style='margin-top: -5px;'><span class='data-name f18'>" + NickName + "</span></p>"
        html += "<div class='post'>"
        html += "<p style='padding: 5px 0 10px; 0;'>" + item.Content + "</p>"
        html += "<div id='picList'>"
        html += getImgs(Imgs.split(",")); //图片列表
        html += "</div>"
        html += "</div>"
        html += "<div style='width: 100%;height: 20px;clear: both;'></div>"
        html += "<div class='padding-top:20px;'>"
        html += "<p class='time'>" + item.Addtime
        if (item.Uid == userid)
            html += "<span class='delect btn-delete' data-id=" + item.Id + ">删除</span></p>"; //自己发布的才能删除
        html += "<div style='position: relative;'>"
        //点赞操作
        html += "<div class='actions_box f12' id='actions_" + item.Id + "' style='display: none; width: 0px;'>"
        html += "<div class='actions-left'onclick='upAdd(" + item.Id + ")'  style='border-right: 1px solid #2E2E32'><img src='../images/boss/like2.png' alt='' ><span>赞</span></div>"
        html += "<div class='actions-left tailk' data-index='" + item.Id + "' ><img src='../images/boss/taik.png' alt=''><span>评论</span></div>"
        html += "</div>"
        html += "<img class='c-icon' data-index='" + item.Id + "' src='../images/boss/12.png' id='up' >"
        html += "</div>"
        html += "<div style='clear: both;'></div>"
        html += "</div>"
        html += "<div class='r'></div>"

        if (upList != '' || commentList != '') {
            html += '<div class="cmt-wrap">'
            if (upList != '')
                html += '<div class="like"><img src="../images/boss/like1.png">' + upList + '</div>';
            if (commentList != '')
                html += '<div class="cmt-list" style="border-top: 1px solid #ddd;">' + commentList + '</div>'
            html += "</div>"
        }
        html += "</li>"
        return html;
    }
    
   
    function loadBtn() {
        $(".btn-delete").click(function () {
            deleteBlog($(this).attr("data-id"))
        });

        //点赞评论弹出框
        $(".c-icon").click(function (e) {
            var index = $(this).attr("data-index")
            var width = $("#actions_" + index).css("width")
            //隐藏弹出框
            $(".actions_box").css("width", "0px");
            $(".actions_box").css("display", "none");
            //显示弹出框
            $("#actions_" + index).css("display", "flex").animate({
                width: "150px"
            });
        })

        //评论
        $("#tailk").on("click", function () {
            $(".tabbar").hide();
            $(".sendMsg").show();
        })

        //发动态
        $(".float-btn").on("click", function () {
            toUrl("editor.html")
        });
    }
</script>
</html>